package com.hzjh.base.ext.widget.dialog

import android.text.method.ScrollingMovementMethod
import android.view.View
import com.hzjh.base.ext.R
import com.hzjh.base.ext.databinding.JhDialogCopywritingBinding
import com.hzjh.base.style.view.dialog.BaseBottomSheetFragment
import com.hzjh.base.style.weight.ToastKt.toastCenter
import com.hzjh.base.utils.other.CommUtils

class JHCopywritingDialog(private val copyStr:String) : BaseBottomSheetFragment(){
    private lateinit var mBinding:JhDialogCopywritingBinding
    override fun getBindingRootView(): View {
        mBinding = JhDialogCopywritingBinding.inflate(layoutInflater)
        return mBinding.root
    }

    override fun initView() {
        //支持滑动
        mBinding.tvCopy.movementMethod = ScrollingMovementMethod.getInstance()
        mBinding.tvCopy.text=copyStr
        mBinding.btnCopy.setOnClickListener {
            CommUtils.copyText(copyStr)
            toastCenter(CommUtils.getString(R.string.jh_copy_tip))
            dismiss()
        }
        mBinding.ivClose.setOnClickListener {
            dismiss()
        }
    }
}